package com.ruoyi.ly.mapper;

import com.github.pagehelper.Page;
import com.ruoyi.ly.domain.SpaceMeeting;
import com.ruoyi.ly.domain.dto.PageSpaceMeetingDTO;
import com.ruoyi.ly.domain.vo.PageSpaceMeetingVO;
import com.ruoyi.ly.domain.vo.SpaceMeetingVO;
import com.ruoyi.ly.domain.vo.TreeChildrenVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SpaceMeetingMapper {
    Page<PageSpaceMeetingVO> pageQuery(PageSpaceMeetingDTO pageSpaceMeetingDTO);

    void insert(SpaceMeeting spaceMeeting);

    @Delete("delete from space_meeting where meet_id = #{meetId}")
    void delete(Long floorId);

    void update(SpaceMeeting spaceMeeting);

    @Select("select sm.*,sb.ban_name,p.project_name from space_meeting sm left join space_ban sb on sm.ban_id = sb.ban_id left join project p on p.id = sm.project_id where meet_id = #{meetId}")
    SpaceMeetingVO selectById(Long floorId);

    @Select("select sm.*,p.project_name,sb.ban_name from space_meeting  sm left join space_ban sb on sm.ban_id = sb.ban_id left join project p on sm.project_id = p.id")
    List<PageSpaceMeetingVO> selectAll();

    //查询所有的功能场地
    List<TreeChildrenVO> selectAllSpaceMeeting(@Param("floorNumber") Long floorNumber, @Param("banID") Long banId);

    //根据功能场地id查询功能场地名称
    @Select("select meet_name from space_meeting where meet_id = #{meetId}")
    String getName(Long meet_id);
}
